<template>
  <view class="yuongjin">

    <view class="form">
      <u-form :border-bottom="false" :model="form" ref="uForm" label-width="180">
        <u-form-item required label="持卡人姓名">
          <u-input v-model="form.bank_username" />
        </u-form-item>
        <u-form-item required label="银行名称">
          <u-input v-model="form.bank_name" />
        </u-form-item>
        <u-form-item required label="开户行名称">
          <u-input v-model="form.bank_branch" />
        </u-form-item>
        <u-form-item required label="银行卡号">
          <u-input v-model="form.bank_number" />
        </u-form-item>
      </u-form>
    </view>

    <view class="btn1" @click="setCank">
      保存
    </view>
  </view>
</template>

<script>
export default {
  components: {
  },
  mixins: [],
  data() {
    return {
      data: {

      },
      form: {
        bank_username: '',
        bank_name: '',
        bank_branch: '',
        bank_number: '',
      },
    }
  },
  onShow() {
    this.liandonginfo()
    this.$api.sendRequest({
      url: "/api/member/judgeBuy",
      success: res => {
        console.log(res,'/api/member/judgeBuy');
        if(!res.data){
          uni.hideShareMenu()
        }
      }
    });
  },
  onLoad(data) {
    },
  methods: {
    liandonginfo() {
      this.$api.sendRequest({
        url: '/api/member/liandonginfo',
        success: res => {
          this.data = res.data
          this.form.bank_username = res.data.bank_username
          this.form.bank_name = res.data.bank_name
          this.form.bank_branch = res.data.bank_branch
          this.form.bank_number = res.data.bank_number
          console.log(this.data, 'this.data');
        }
      });
    },
    setCank(){
      this.$api.sendRequest({
        url: '/api/member/liandongsavebank',
        data: this.form,
        success: res => {
          this.$util.showToast({
            title: res.msg,
            icon: 'none',
            duration: 2000,
            success: () => {
              this.$util.redirectTo('/pages_promotion/member/settlement')
            }
          })
        }
      });
    }
  },
  onShareTimeline() {
    return {
      title: '鹏城快享',
      query: `source_member=${uni.getStorageSync("user_id")}`,
      imageUrl: ""
    }
  },
  onShareAppMessage() {
    return {
      title: "鹏城快享",
      path: `/pages/index/index?source_member=${uni.getStorageSync("user_id")}`,
      imageUrl: ''
    }
  },
};
</script>

<style lang="scss" scoped>
@import '@/common/css/diy.scss';

.yuongjin {
  margin: 20rpx 30rpx;
  padding-bottom: 30px;

  .form {
    background-color: #fff;
    padding: 10px 20px;
    border-radius: 10px;
    margin-bottom: 10px;

    .all-election {
      display: flex;
      gap: 5rpx;
    }



    .color-base-text {
      color: #1aac19 !important;
    }
  }
}

.tip {
  color: #999;
  line-height: initial;
}

.typeMoney {
  display: flex;
    justify-content: space-between;
    background: #f8f8f8;
    border-radius: 10px 20px;
    margin: 15px 0;
    padding: 5px 10px;
    .flex {
      display: flex;  
      align-items: center;
    }

  .img {
    width: 30px;
    height: 30px;
    margin-right: 5px;
  }
}
.btn1 {
  background-color: #fe5e0a;
    padding: 10px 0;
    text-align: center;
    color: #fff;
    border-radius: 10px;
    margin-bottom: 10px;
}

</style>

